/*******************************************************************************
 * Copyright(c) 2023 Levetop Semiconductor Co.,Led. All rights reserved.
 * @file     gif.c
 * @author   UartTFT Application Team
 * @version  V0.0.1
 * @date     2023-01-11
 * @brief    This file provides UartTFT Application display function
 ********************************************************************************/
#include "gif.h"
#include "bsp.h"
#include "data.h"
#include "keyBoard.h"
#include "css_psram.h"
#include "lt168_qspi.h"

#include "popupBox.h"
#include "levetop.h"
#include "transport.h"
#include "uart.h"
#include "function_drv.h"


uint8_t Gif_num = 0;
uint8_t Gif_flag = 0;
Gif_Info gGif_Info[GIF_SIZE];

void show_gif(void)
{
	if (Gif_num > 0 && Gif_flag == 1)
	{
		Gif_flag = 0;

		for (uint8_t i = 0; i < Gif_num; i++)
			gGif_Info[i].t_c++;
		for (uint8_t i = 0; i < Gif_num; i++)
		{
			if (gGif_Info[i].t_c >= gGif_Info[i].t_d ) // display picture of gif
			{

				LT_ShowGifPicture(i);
				gGif_Info[i].t_c = 0;
			}
		}
	}
}
/***********************************************************************************
* Function Name : gif_display
* Description   : Show picture of gif.
* Input         : - type: gif info sources
				  - buff: gif info
* Output        : None
* Return        : None
************************************************************************************/
void gif_display(uint8_t type, uint8_t *buff)
{
	uint8_t rbuff[16], i;
	uint16_t p_add, p_len, pointer;
	uint16_t x, y, w, h;
	uint16_t V_stop, V_start, gif_id, V_once;
	uint8_t reset_En, mode, t_d;
	uint32_t pic_addr;

	uint16_t overlay = 0;
	if (type == 0) // instruction information source is configuration file
	{

		p_add = buff[5] + (buff[6] << 8);
		x = buff[7] + (buff[8] << 8);
		y = buff[9] + (buff[10] << 8);
		w = buff[11] + (buff[12] << 8);
		h = buff[13] + (buff[14] << 8);
		gif_id = buff[15] + (buff[16] << 8);
		reset_En = buff[17];
		t_d = buff[18];
		V_start = buff[19] + (buff[20] << 8);
		V_stop = buff[21] + (buff[22] << 8);
		mode = buff[23];
		V_once = buff[24] + (buff[25] << 8);
		for (i = 0; i < 32; i += 4)
		{
			gGif_Info[Gif_num].var_addr[i / 4] = buff[26 + i] + (buff[26 + i + 1] << 8);
			gGif_Info[Gif_num].var[i / 4] = buff[26 + i + 2] + (buff[26 + i + 3] << 8);
		}
		for(i=0;i<8;i++)
			Var_AddrRemapping(&gGif_Info[Gif_num].var_addr[i]);

		overlay = buff[58] + (buff[59] << 8);
	}
	else if (type == 1) // instruction information ource is variable space
	{
		pointer = buff[2] + (buff[3] << 8) * 2;
		p_add = var[pointer + 1] + (var[pointer + 2] << 8);
		x = var[pointer + 3] + (var[pointer + 4] << 8);
		y = var[pointer + 5] + (var[pointer + 6] << 8);
		w = var[pointer + 7] + (var[pointer + 8] << 8);
		h = var[pointer + 9] + (var[pointer + 10] << 8);
		gif_id = var[pointer + 11] + (var[pointer + 12] << 8);
		reset_En = var[pointer + 13];
		t_d = var[pointer + 14];
		V_start = var[pointer + 15] + (var[pointer + 16] << 8);
		V_stop = var[pointer + 17] + (var[pointer + 18] << 8);
		mode = var[pointer + 19];
		V_once = var[pointer + 20] + (var[pointer + 21] << 8);
		for (i = 0; i < 32; i += 4)
		{
			gGif_Info[Gif_num].var_addr[i / 4] = var[pointer + 22 + i] + (var[pointer + 22 + i + 1] << 8);
			gGif_Info[Gif_num].var[i / 4] = var[pointer + 22 + i + 2] + (var[pointer + 22 + i + 3] << 8);
		}
		for(i=0;i<8;i++)
			Var_AddrRemapping(&gGif_Info[Gif_num].var_addr[i]);

		overlay =var[pointer + 54] + (var[pointer + 55] << 8);
	}

	if (Pop_up_flag == 1) // Popup offset
	{
		x += Pop_up_x;
		y += Pop_up_y;
	}

	gGif_Info[Gif_num].p_add = p_add;
	gGif_Info[Gif_num].x = x;
	gGif_Info[Gif_num].y = y;
	gGif_Info[Gif_num].w = w;
	gGif_Info[Gif_num].h = h;
	gGif_Info[Gif_num].gif_id = gif_id;
	gGif_Info[Gif_num].reset_En = reset_En;
	gGif_Info[Gif_num].t_d = t_d;
	gGif_Info[Gif_num].V_stop = V_stop;
	gGif_Info[Gif_num].V_start = V_start;
	gGif_Info[Gif_num].V_once = V_once;
	gGif_Info[Gif_num].mode = mode;
	gGif_Info[Gif_num].p_c = 0;
	gGif_Info[Gif_num].flag = 0;
	gGif_Info[Gif_num].omode = 0;
	LT_ReadFlash_UI(rbuff, addr_index[8] + gif_id * 8, 8);
	gGif_Info[Gif_num].addr = rbuff[0] + (rbuff[1] << 8) + (rbuff[2] << 16) + (rbuff[3] << 24);
	gGif_Info[Gif_num].total = rbuff[4] + (rbuff[5] << 8) + (rbuff[6] << 16);
	gGif_Info[Gif_num].overlay = overlay;


	/*Display the first frame when stopping*/
	if (((var[gGif_Info[Gif_num].p_add * 2] << 8) + var[gGif_Info[Gif_num].p_add * 2 + 1]) == gGif_Info[Gif_num].V_stop)
	{
		gGif_Info[Gif_num].flag = 1;
		LT_ReadFlash_UI(rbuff, gGif_Info[Gif_num].addr, 16);
		pic_addr = rbuff[0] + (rbuff[1] << 8) + (rbuff[2] << 16) + (rbuff[3] << 24);
		pic_flag = rbuff[15];

		if ((pic_flag >= 0 && pic_flag < 6) || pic_flag == ColorARGB8565)
		{
			if (overlay == 0xFFFF)
				LT_ShowPicture(gGif_Info[Gif_num].x, gGif_Info[Gif_num].y, gGif_Info[Gif_num].w, gGif_Info[Gif_num].h, pic_addr, pic_len, pic_flag);
			else
			{
				if(pic_update == 0)
				{
					if (pic_flag == 1 || pic_flag == 2 || pic_flag == 4 || pic_flag == 5)
					{
						LT268_BG_to_buffer(0, 0, w, m_PngData,x, y,w, h);
					}

					LT268_pic_to_buffer(0,0,gGif_Info[Gif_num].w,m_PngData,
										0,0,gGif_Info[Gif_num].w,pic_addr,
										gGif_Info[Gif_num].w, gGif_Info[Gif_num].h,pic_flag);

					Get_date_variable_Id_overlay(pic_id,overlay,gGif_Info[Gif_num].x,gGif_Info[Gif_num].y,gGif_Info[Gif_num].w,gGif_Info[Gif_num].h);


					LT268_buffer_to_TFT(0,0,gGif_Info[Gif_num].w,m_PngData,
										gGif_Info[Gif_num].x,gGif_Info[Gif_num].y,gGif_Info[Gif_num].w,gGif_Info[Gif_num].h);
				}
				else
				{
					LT268_pic_to_buffer(gGif_Info[Gif_num].x,gGif_Info[Gif_num].y,FullScreen_w,m_PngData,
										0,0,gGif_Info[Gif_num].w,pic_addr,
										gGif_Info[Gif_num].w, gGif_Info[Gif_num].h,pic_flag);

					Get_date_variable_Id_overlay(pic_id,overlay,gGif_Info[Gif_num].x,gGif_Info[Gif_num].y,FullScreen_w,FullScreen_h);
				}
				gGif_Info[Gif_num].omode = 1;
			}
		}
		gGif_Info[Gif_num].p_c++;
	}

	LT_ShowGifPicture(Gif_num);
	Gif_num++;
}

uint8_t LT_ShowGifPicture(uint8_t num)
{
	uint8_t rbuff[16], i;
	uint32_t pic_addr;
	uint16_t overlay;
	uint16_t page_flag = 0;
	if (((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == gGif_Info[num].V_start)
	{
		if (gGif_Info[num].flag == 2) gGif_Info[num].p_c = 0;
		gGif_Info[num].flag = 1;
		gGif_Info[num].omode = 1;
		if (gGif_Info[num].p_c >= gGif_Info[num].total)
			gGif_Info[num].p_c = 0;

		// In the keyboard input interface
		if (DioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gDio_Info[Dio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gDio_Info[Dio_num].Xs || gGif_Info[num].y > gDio_Info[Dio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gDio_Info[Dio_num].Ys))
			{
				return 0;
			}
		}
		else if (AioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gAio_Info[Aio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gAio_Info[Aio_num].Xs || gGif_Info[num].y > gAio_Info[Aio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gAio_Info[Aio_num].Ys))
			{
				return 0;
			}
		}
		else if (GBKioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gGBKio_Info[GBKio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gGBKio_Info[GBKio_num].Xs || gGif_Info[num].y > gGBKio_Info[GBKio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gGBKio_Info[GBKio_num].Ys))
			{
				return 0;
			}
		}

		LT_ReadFlash_UI(rbuff, gGif_Info[num].addr + gGif_Info[num].p_c * 16, 16);
		pic_addr = rbuff[0] + (rbuff[1] << 8) + (rbuff[2] << 16) + (rbuff[3] << 24);
		pic_flag = rbuff[15];

		if ((pic_flag >= 0 && pic_flag < 6) || pic_flag == ColorARGB8565)
		{


			if (gGif_Info[num].overlay == 0xFFFF)
			{
				LT_ShowPicture(gGif_Info[num].x, gGif_Info[num].y, gGif_Info[num].w, gGif_Info[num].h, pic_addr, pic_len, pic_flag);
			}
			else
			{
				if(pic_update == 0)
				{
					if (pic_flag == 1 || pic_flag == 2 || pic_flag == 4 || pic_flag == 5)
					{
						LT268_BG_to_buffer(0, 0, gGif_Info[num].w, m_PngData,
								gGif_Info[num].x, gGif_Info[num].y,gGif_Info[num].w, gGif_Info[num].h);
					}

					LT268_pic_to_buffer(0,0,gGif_Info[num].w,m_PngData,
										0,0,gGif_Info[num].w,pic_addr,
										gGif_Info[num].w, gGif_Info[num].h,pic_flag);


					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);


					LT268_buffer_to_TFT(0,0,gGif_Info[num].w,m_PngData,
										gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);

				}
				else
				{
					LT268_pic_to_buffer(gGif_Info[num].x,gGif_Info[num].y,FullScreen_w,m_PngData,
										0,0,gGif_Info[num].w,pic_addr,
										gGif_Info[num].w, gGif_Info[num].h,pic_flag);

					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,FullScreen_w,gGif_Info[num].h);
				}

			}
		}
			//LT_ShowPicture(gGif_Info[num].x, gGif_Info[num].y, gGif_Info[num].w, gGif_Info[num].h, pic_addr, pic_len, pic_flag);


		gGif_Info[num].p_c++;
	}
	else if (((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == gGif_Info[num].V_once)
	{
		if (gGif_Info[num].flag == 2) gGif_Info[num].p_c = 0;
		gGif_Info[num].flag = 1;
		gGif_Info[num].omode = 1;
		if (gGif_Info[num].p_c >= gGif_Info[num].total)
		{
			gGif_Info[num].p_c = 0;
			var[gGif_Info[num].p_add * 2] = (gGif_Info[num].V_stop >> 8) & 0xFF;
			var[gGif_Info[num].p_add * 2 + 1] = (gGif_Info[num].V_stop) & 0xFF;
			for (i = 0; i < 8; i++)
			{
				if (gGif_Info[num].var_addr[i] != 0xFFFF && gGif_Info[num].var_addr[i] <= VAR_ADDR_E)
				{
					var[gGif_Info[num].var_addr[i] * 2] = (gGif_Info[num].var[i] >> 8) & 0xFF;
					var[gGif_Info[num].var_addr[i] * 2 + 1] = gGif_Info[num].var[i] & 0xFF;

					if (gGif_Info[num].var_addr[i] > VAR_ADDR_S)
					{
						reg_operation(gGif_Info[num].var_addr[i]);
					}
					else if (gGif_Info[num].var_addr[i] == VAR_PAGE)
					{
						page_flag = 1;
					}
				}
			}

			if (page_flag == 1)
				reg_operation(VAR_PAGE);
			return 0;
		}



		// In the keyboard input interface
		if (DioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gDio_Info[Dio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gDio_Info[Dio_num].Xs || gGif_Info[num].y > gDio_Info[Dio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gDio_Info[Dio_num].Ys))
			{
				return 0;
			}
		}
		else if (AioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gAio_Info[Aio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gAio_Info[Aio_num].Xs || gGif_Info[num].y > gAio_Info[Aio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gAio_Info[Aio_num].Ys))
			{
				return 0;
			}
		}
		else if (GBKioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gGBKio_Info[GBKio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gGBKio_Info[GBKio_num].Xs || gGif_Info[num].y > gGBKio_Info[GBKio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gGBKio_Info[GBKio_num].Ys))
			{
				return 0;
			}
		}
		LT_ReadFlash_UI(rbuff, gGif_Info[num].addr + gGif_Info[num].p_c * 16, 16);
		pic_addr = rbuff[0] + (rbuff[1] << 8) + (rbuff[2] << 16) + (rbuff[3] << 24);
		pic_flag = rbuff[15];

		if ((pic_flag >= 0 && pic_flag < 6) || pic_flag == ColorARGB8565)
		{

			if (gGif_Info[num].overlay == 0xFFFF)
				LT_ShowPicture(gGif_Info[num].x, gGif_Info[num].y, gGif_Info[num].w, gGif_Info[num].h, pic_addr, pic_len, pic_flag);
			else
			{
				if(pic_update == 0)
				{
					if (pic_flag == 1 || pic_flag == 2 || pic_flag == 4 || pic_flag == 5)
					{
						LT268_BG_to_buffer(0, 0, gGif_Info[num].w, m_PngData,
								gGif_Info[num].x, gGif_Info[num].y,gGif_Info[num].w, gGif_Info[num].h);
					}

					LT268_pic_to_buffer(0,0,gGif_Info[num].w,m_PngData,
										0,0,gGif_Info[num].w,pic_addr,
										gGif_Info[num].w, gGif_Info[num].h,pic_flag);

					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);


					LT268_buffer_to_TFT(0,0,gGif_Info[num].w,m_PngData,
										gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);

				}
				else
				{
					LT268_pic_to_buffer(gGif_Info[num].x,gGif_Info[num].y,FullScreen_w,m_PngData,
										0,0,gGif_Info[num].w,pic_addr,
										gGif_Info[num].w, gGif_Info[num].h,pic_flag);

					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,FullScreen_w,gGif_Info[num].h);

				}
			}
		}
			//LT_ShowPicture(gGif_Info[num].x, gGif_Info[num].y, gGif_Info[num].w, gGif_Info[num].h, pic_addr, pic_len, pic_flag);

		gGif_Info[num].p_c++;
	}
	else if (((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == gGif_Info[num].V_stop)
	{
		// In the keyboard input interface
		if (DioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gDio_Info[Dio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gDio_Info[Dio_num].Xs || gGif_Info[num].y > gDio_Info[Dio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gDio_Info[Dio_num].Ys))
			{
				return 0;
			}
		}
		else if (AioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gAio_Info[Aio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gAio_Info[Aio_num].Xs || gGif_Info[num].y > gAio_Info[Aio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gAio_Info[Aio_num].Ys))
			{
				return 0;
			}
		}
		else if (GBKioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gGBKio_Info[GBKio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gGBKio_Info[GBKio_num].Xs || gGif_Info[num].y > gGBKio_Info[GBKio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gGBKio_Info[GBKio_num].Ys))
			{
				return 0;
			}
		}

		if (gGif_Info[num].flag == 1) gGif_Info[num].omode  = 1;
		else if(gGif_Info[num].flag == 0) gGif_Info[num].omode = 0;

		if (gGif_Info[num].reset_En == 1) // gif reset
		{
			gGif_Info[num].flag = 2;
			//gGif_Info[num].p_c = 0;
		}
	}
	else if (((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == 0xFFFF)
	{
		gGif_Info[num].omode = 0;
		// In the keyboard input interface
		if (DioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gDio_Info[Dio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gDio_Info[Dio_num].Xs || gGif_Info[num].y > gDio_Info[Dio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gDio_Info[Dio_num].Ys))
			{
				return 0;
			}
		}
		else if (AioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gAio_Info[Aio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gAio_Info[Aio_num].Xs || gGif_Info[num].y > gAio_Info[Aio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gAio_Info[Aio_num].Ys))
			{
				return 0;
			}
		}
		else if (GBKioKb_flag == 1)
		{
			if (!(gGif_Info[num].x > gGBKio_Info[GBKio_num].Xe || (gGif_Info[num].x + gGif_Info[num].w) < gGBKio_Info[GBKio_num].Xs || gGif_Info[num].y > gGBKio_Info[GBKio_num].Ye || (gGif_Info[num].y + gGif_Info[num].h) < gGBKio_Info[GBKio_num].Ys))
			{
				return 0;
			}
		}
		if (gGif_Info[num].flag != 0)
		{
			if (gGif_Info[num].overlay == 0xFFFF && pic_update == 0)
			{
				LT268_dispaly_CutPicture(gGif_Info[num].x, gGif_Info[num].y,
										 gGif_Info[num].x, gGif_Info[num].y, gGif_Info[num].w, gGif_Info[num].h,
											 LCD_XSIZE_TFT, FullScreen_addr, FullScreen_color, FullScreen_flag);
			}
			else
			{

				if(pic_update == 0)
				{
					LT268_BG_to_buffer(0, 0, gGif_Info[num].w, m_PngData,
							gGif_Info[num].x, gGif_Info[num].y,gGif_Info[num].w, gGif_Info[num].h);

					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);


					LT268_buffer_to_TFT(0,0,gGif_Info[num].w,m_PngData,
										gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);
				}
				else
				{
					Get_date_variable_Id_overlay(pic_id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,FullScreen_w,gGif_Info[num].h);
				}
			}
			gGif_Info[num].flag = 0;
		}
		gGif_Info[num].p_c = 0;
	}

}



void gif_overlay_update(uint16_t id,uint8_t num)
{
	uint32_t pic_addr;
	uint8_t buff1[16];
	uint8_t p_c;
	if (gGif_Info[num].overlay != 0xFFFF)
	{
		if (Get_date_variable_Id_overlay_update(id,gGif_Info[num].overlay))
		{
			if ((((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == gGif_Info[num].V_stop)
					|| (((var[gGif_Info[num].p_add * 2] << 8) + var[gGif_Info[num].p_add * 2 + 1]) == 0xFFFF))
			{
			if (gGif_Info[num].p_c == 0)
				p_c = gGif_Info[num].total - 1;
			else
				p_c = gGif_Info[num].p_c - 1;
			LT_ReadFlash_UI(buff1, gGif_Info[num].addr + p_c * 16, 16);
			pic_addr = buff1[0] + (buff1[1] << 8) + (buff1[2] << 16) + (buff1[3] << 24);
			pic_flag = buff1[15];



			if (gGif_Info[num].omode == 1)
			{
				if (pic_flag == 1 || pic_flag == 2 || pic_flag == 4 || pic_flag == 5)
				{
					LT268_BG_to_buffer(0, 0, gGif_Info[num].w, m_PngData,
							gGif_Info[num].x, gGif_Info[num].y,gGif_Info[num].w, gGif_Info[num].h);
				}

				LT268_pic_to_buffer(0,0,gGif_Info[num].w,m_PngData,
									0,0,gGif_Info[num].w,pic_addr,
									gGif_Info[num].w, gGif_Info[num].h,pic_flag);
			}
			else if (gGif_Info[num].omode == 0)
			{
				LT268_BG_to_buffer(0, 0, gGif_Info[num].w, m_PngData,
									gGif_Info[num].x, gGif_Info[num].y,gGif_Info[num].w, gGif_Info[num].h);
			}


			Get_date_variable_Id_overlay(id,gGif_Info[num].overlay,gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);


			LT268_buffer_to_TFT(0,0,gGif_Info[num].w,m_PngData,
								gGif_Info[num].x,gGif_Info[num].y,gGif_Info[num].w,gGif_Info[num].h);
			}

		}
	}
}





